<template>
  <div
    class="exam-entry"
    @click="onNavTest"
  >
    <h3 class="exam-name">
      {{ paper.Name }}
    </h3>
    <!-- && !paper.IsPublished -->
    <div
      class="exam-info"
    >
      <div
        class="can-do"
      >
        {{ paper.Description }}
      </div>
      <div
        v-if="paper.CreateTime"
        class="done-time"
      >
        {{ paper.CreateTime }}
      </div>
    </div>
    <!-- <template v-else>
      <div class="can-do">
        {{ visitorType === -1 && $store.state.instInfo.TryQuestionCount !== -1
          ? `可试做${$store.state.instInfo.TryQuestionCount}道` : '公开试卷' }}
      </div>
    </template> -->
  </div>
</template>

<script lang="ts">
import Vue from 'vue'
export default Vue.extend({
  props: {
    paper: {
      type: Object,
      default: () => {},
    },
    visitorType: {
      type: Number,
      default: 0, // 用户状态 -1：游客 0：注册会员 1：报名学员
    },
    paperType: {
      type: String,
      default: '1', // 考试类型 0: 错题 1：模拟考试，2：历年真题，3.章节练习，4 每日一练，10 高频数据
    },
    classId: {
      type: Number,
      default: 0,
    },
  },
  methods: {
    onNavTest () {
      this.$router.push({
        name: 'examTest',
        query: {
          Type: this.paperType,
          PaperId: this.$route.name === 'examRecords' ? this.paper.PaperId : this.paper.Id,
          subj: this.paper.Name,
        },
      })
    },
  },
})
</script>

<style lang="scss" scoped>
.exam-entry {
  padding: 29px;
  color: #999;
  font-size: 24px;
  background: #f7f7f7;
  + .exam-entry {
    // border-top: 1px solid #E9E9E9;
    @include px1border(top, #E9E9E9);
  }
}
.exam-name {
  color: #333;
  font-size: 30px;
  margin-bottom: 20px;
  @include ellipsis;
}
.exam-info {
  padding-top: 10px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}
.class-name {
  font-size: 26px;
  color: #333;
  margin-bottom: 10px;
}
</style>
